TangentLine[f_,x_,a_]:=Module[{deriv,m,line},deriv=D[f,x];
m=ReplaceAll[deriv,x->a];
line=Expand[m*(x-a)+ReplaceAll[f,x->a]];
Return[line]]

f[x_]:=(x-1)(x-2)(x-3)

tl=TangentLine[f[x],x,0.4]

f[x]

Plot[Evaluate[TangentLine[f[x],x,0.4]], {x,0,4}]

Plot[f[x], {x,0,4}]

Plot[Evaluate[{f[x],TangentLine[f[x],x,0.4]}], {x,0,4}]

Manipulate[Plot[Evaluate[{f[x],TangentLine[f[x],x,a]}], {x,0,4}, AspectRatio->1],{a,0,4}]